package com.prd.controller;


import com.prd.feign.SysDeptFeignService;
import com.prd.service.OaDepartService;
import com.prd.service.OaDepartmentService;
import com.prd.util.JsonData;
import com.prd.vo.OaDepartmentDescVo;
import com.prd.vo.OaDepartmentPostDescVo;
import com.prd.vo.OaDeptmentPositionDescVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 人事管理-部门管理数据表 前端控制器
 * </p>
 *
 * @author lizhaoyi
 * @since 2024-01-28
 */
@RestController
@RequestMapping("/api/oaDepartment")
@Api(tags = "部门管理")
public class OaDepartmentController {

    @Autowired
    private OaDepartmentService departmentService;

    @Autowired
    private SysDeptFeignService deptFeignService;


    @ApiOperation("申请接收")
    @GetMapping("receive")
    public JsonData getApplyList(){

        return departmentService.getApplyList();
    }

    @ApiOperation("部门管理列表")
    @GetMapping("list")
    public JsonData getDeptList(){

        return departmentService.getDeptList();
    }

    @ApiOperation("根据部门id获取相关岗位职务列表")
    @GetMapping("detail/{id}")
    public JsonData getDeptDetailById(@PathVariable("id") Long id){

        return deptFeignService.getPositionByDeptId(id);
    }

    @ApiOperation("根据职务id获取岗位列表")
    @GetMapping("getPostByPositionId/{id}")
    public JsonData getPostByPositionId(@PathVariable("id") Long id){

        return deptFeignService.getPostByPositionId(id);
    }

    @ApiOperation("根据部门id获取部门职责书")
    @GetMapping("getDeptDesc/{id}")
    public JsonData getDeptDescById(@PathVariable("id") Long id){

        return deptFeignService.getDeptDescById(id);
    }

    @ApiOperation("根据职务id获取职务说明书")
    @GetMapping("getPositionDesc/{id}")
    public JsonData getPositionDescById(@PathVariable("id") Long id){

        return deptFeignService.getPositionDescById(id);
    }

    @ApiOperation("根据岗位id获取岗位说明书")
    @GetMapping("getPostDesc/{id}")
    public JsonData getPostDescById(@PathVariable("id") Long id){

        return deptFeignService.getPostDescById(id);
    }


    @ApiOperation("部门职责书修改")
    @PutMapping("update/dept")
    public JsonData updateDeptDesc(@RequestBody OaDepartmentDescVo descVo){

        return deptFeignService.editDeptDesc(descVo);
    }

    @ApiOperation("职务说明书修改")
    @PutMapping("update/Position")
    public JsonData updatePositionDesc(@RequestBody OaDeptmentPositionDescVo positionDescVo){

        return deptFeignService.editPositionDesc(positionDescVo);
    }


    @ApiOperation("岗位说明书修改")
    @PutMapping("update/post")
    public JsonData updatePostDesc(@RequestBody OaDepartmentPostDescVo postDescVo){

        return deptFeignService.editPostDesc(postDescVo);
    }


    @ApiOperation("查看审批进度")
    @GetMapping("select/process")
    public JsonData getProcessList(){
        //TODO 需结合团队管理
        return null;
    }

    @ApiOperation("办结回复")
    @GetMapping("doneReply")
    public JsonData doneReply(){

        //TODO 需结合团队管理
        return null;
    }


}

